﻿using LY.DataAccess.Repository;
using LY.Entity;
using LY.Entity.PageSearch;
using LY.Entity.SearchEntity;
using LY.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LY.Business.ServiceImpl
{
    public class BankCardService : IBankCardService
    {
        BankCardRepository _bank;

        public BankCardService()
        {
            _bank = new BankCardRepository();
        }
        //添加银行卡绑定信息
        public long BindCard(U_BankCard bankCard)
        {
            if (bankCard.Id <= 0)
            {
                //执行新增操作
                return (int)_bank.Insert(bankCard);
            }
            else
            {
                //执行修改操作
                return (int)_bank.Update(bankCard);
            }
        }
        //获取银行卡绑定信息

        public PagedList<U_BankCard> Getbank(int id, PageView view)
        {
            return _bank.GetBankCardList(id, view);
        }
        //删除绑定
        public int deleteCard(int id)
        {
            return _bank.DeleteCard(id);
        }

        //根据会员ID获取银行卡信息
        public List<U_BankCard> GetbankcardList(int mId)
        {
            return _bank.GetbankcardList(mId);
        }
        //根据银ID获取绑定信息
        public U_BankCard GetcardByID(int id)
        {
            return _bank.GetcardByID(id);
        }

        //根据银行卡号获取绑定信息
        public U_BankCard getCard(string card)
        {
            return _bank.Getcard(card);
        }
        //根据项目id获取银行卡信息
        public U_BankCard GetCardByProId(int projectId)
        {
            return _bank.GetCardByProId(projectId);
        }
    }
}
